<include file="Public/head" />
<style type="text/css">
	.nonetips{text-align: left; border-bottom: solid 1px #ddd; padding-bottom: 10px; color: red}
</style>

<body>
	<div class="panel admin-panel">
		<div class="panel-head"><strong class="icon-reorder"> 管理小程序</strong></div>
		<div class="padding border-bottom"></div>
		<table class="table table-hover text-center">
			<tr><th colspan="4" style="background: #f9f9f9; text-align: left">发布中的小程序</th></tr>
			<tr>
				<th width="15%">更新时间</th>
				<th width="50%">状态</th>
				<th width="15%">操作</th>
			</tr>
			<empty name='list_fb'>
				<tr><td colspan="4">
					<div class="nonetips">暂无发布中的小程序，请先上传审核小程序</div>
				</td></tr>
			</empty>
			<foreach name="list_fb" item="v">
				<tr style="border-bottom: solid 1px #ddd;">
					<td>{$v['add_time']|date='Y-m-d H:i:s',###}</td>
					<td style="color: blue"><if condition="$v['show'] eq 0">已发布，可在微信小程序中搜索</if></td>
					<td>
						<div class="button-group">
							<a class="button border-main" href="{:U('Accredit/manager_add',array('id'=>$v['id']))}"><span class="icon-edit"></span> 编辑</a>
							<a class="button border-red" href="{:U('Accredit/manager_sh',array('id'=>$v['id']))}" onclick="return sh()"><span class="icon-trash-o"></span> 重新上传</a>
						</div>
					</td>
				</tr>
			</foreach>
		</table>

		<table class="table table-hover text-center" style="margin-top: 20px; border-top: solid 1px #ddd;">
			<tr><th colspan="4" style="background: #f9f9f9; text-align: left">审核中的小程序</th></tr>
			<tr>
				<th width="15%">更新时间</th>
				<th width="20%">体验二维码</th>
				<th width="50%">状态</th>
				<th width="15%">操作</th>
			</tr>
			<empty name='list_sh'>
				<tr><td colspan="4">
					<div class="nonetips">暂无发布中的小程序，请先上传提交审核小程序</div>
				</td></tr>
			</empty>
			<foreach name="list_sh" item="a">
				<tr style="border-bottom: solid 1px #ddd;">
					<td>{$a['add_time']|date='Y-m-d H:i:s',###}</td>
					<td><img src="{$a['mypic']}" width="100px"></td>
					<td>{$a['reason']}</td>
					<td>
						<div class="button-group">
							<if condition="$a['reason'] eq '可发布'"><a class="button border-main" href="{:U('Accredit/manager_fb',array('id'=>$a['id']))}" onclick="return sh()"><span class="icon-edit"></span> 发布</a></if>
							<if condition="$a['status'] eq 1">
								<a class="button border-main" href="{:U('Accredit/manager_add',array('id'=>$a['id']))}"><span class="icon-edit"></span> 编辑</a>
								<a class="button border-red" href="{:U('Accredit/manager_sh',array('id'=>$a['id']))}" onclick="return sh()"><span class="icon-trash-o"></span> 重新上传</a>
							<else/>
								<font color="red">待审核结束后才可进行修改</font>
							</if>
						</div>
					</td>
				</tr>
			</foreach>
		</table>

		<table class="table table-hover text-center" style="margin-top: 20px; border-top: solid 1px #ddd;">
			<tr><th colspan="4" style="background: #f9f9f9; text-align: left">上传中的小程序</th></tr>
			<tr>
				<th width="15%">更新时间</th>
				<th width="20%">体验二维码</th>
				<th width="50%">状态</th>
				<th width="15%">操作</th>
			</tr>
			<tr class="list_sc" style="<empty name='list_sc'>display: table-row<else/>display: none</empty>"><td colspan="4" style="color: red" align="left">
				暂无上传中小程序　
				<if condition="!$list_fb and !$list_sh and !$list_sc"><a class="button border-main icon-plus-square-o" href="{:U('Accredit/manager_add')}"> 上传小程序</a></if>
			</td></tr>
			<foreach name="list_sc" item="l">
				<tr class="tr{$l['id']}">
					<td>{$l['add_time']|date='Y-m-d H:i:s',###}</td>
					<td><if condition="$l['state'] eq 0"><img src="{$l['mypic']}" width="100px"></if></td>
					<td>待上传</td>
					<td>
						<div class="button-group">
							<a class="button border-main" href="{:U('Accredit/manager_sh',array('id'=>$l['id']))}" onclick="return sh()"><span class="icon-edit"></span> 上传审核</a>
							<a class="button border-main" href="{:U('Accredit/manager_add',array('id'=>$l['id']))}"><span class="icon-edit"></span> 编辑</a>
							<a class="button border-red" href="javascript:void(0)" onclick="return del({$l['id']})"><span class="icon-trash-o"></span> 删除</a>
						</div>
					</td>
				</tr>
			</foreach>
		</table>
	</div>
</body>
<script type="text/javascript">
	function del(id){
		if(confirm("确认删除吗？")){
			var url = "{:U('Accredit/manager_del')}";
			$.getJSON(url,{id:id},function (data){
				if(data.result == 'yes'){$(".tr"+id).remove();$(".list_sc").show();}
				else{alert('参数错误');}
			})
		}
	}
	function sh(){
		if(confirm("确认要上传审核吗？")){
			return true;
		}else{
			return false;
		}
	}
</script>

</html>